function [  Success , CurRunDB ,Original_Signal_Time_axit, Original_Signal ] = mwcSimulator(SigStruct , MWCStruct, SNR_VEC )
%MWCSIMULATOR Summary of this function goes here
%   Detailed explanation goes here
CurRunDB = struct ;
Success=zeros(length(SNR_VEC),1);
RecoveredSupport={};
%% Set general parameters values

%% Generate Signal
    [SignalAmpAnalog, NoiseAmpAnalog, Analog_TimeAxis,Signal ] = generateAnalogSignal( SigStruct,MWCStruct );
    Original_Signal=SignalAmpAnalog;
    Original_Signal_Time_axit=Analog_TimeAxis;
    
%% MWC ANALOG FRONT-END
for j=1:length(SNR_VEC)
    
    SNR = SNR_VEC(j);
    
    [SignalSampleSequences, Sample_t_axis] = MWC_SubNyquistSample(Signal,MWCStruct,SignalAmpAnalog,...
        NoiseAmpAnalog, Analog_TimeAxis,SNR);

%% EXPANDER
     [fp_rate_SignalSamples, fp_time_axis] = SignalExpander( Signal,MWCStruct, SignalSampleSequences, Sample_t_axis );  
    
%% Compute Support
     S = CalculateSupport(Signal,MWCStruct);
     
%% SUPPORT RECOVERY
    [RecoveredSupport  ,Success, AsampleMat] = RecoverSupport(Signal, MWCStruct, fp_rate_SignalSamples, fp_time_axis,S);
     
%     plotSequenceCoeff( 8,AsampleMat,MWCStruct );
%% SIGNAL RECOVERY
    % Print Supports:
    S
    RecoveredSupport
    % "Is contained" check:
    if (Success==1)
%         RecoveredSupport=S; %SHAHAR - Trying to change the recovered support to the real one
       [RecSignal, RecTimeAxis] = RecoverSignal(Signal,MWCStruct,RecoveredSupport,fp_rate_SignalSamples,fp_time_axis,AsampleMat);
    else
        error('FAILED! {Success = 0}');
    end  
    %de-modulate the signal
%%
    
end
%% Store Sim Data to CurrResuls structure
CurRunDB.Analog_timeAxis = Analog_TimeAxis;
CurRunDB.ReferenceSupport = S;
CurRunDB.SigValues = Signal.Values;
CurRunDB.AnalogSignal= SignalAmpAnalog;
CurRunDB.RecoveredSupport =RecoveredSupport   ; 
CurRunDB.SamplingMatrix = AsampleMat;
CurRunDB.fp_signal = fp_rate_SignalSamples;
CurRunDB.fp_time_axis = fp_time_axis;
CurRunDB.SignalAmpAnalog=SignalAmpAnalog;
CurRunDB.NoiseAmpAnalog=NoiseAmpAnalog;
CurRunDB.Carriers = Signal.Values.Carriers;
CurRunDB.RecSignal = RecSignal;
CurRunDB.RecTimeAxis =  RecTimeAxis;


end

